class Solution(object):
    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """
        # for i in range(len(nums) - 1, 0, -1):
        #     if nums[i] == val:
        #         del nums[i]
        i = len(nums) - 1
        while i > -1:
            if nums[i] == val:
                del nums[i]
            i = i - 1
        return len(nums)


if __name__ == '__main__':
    s = Solution()
    print(s.removeElement([3, 2, 2, 3], 3))
